<?php

namespace App\Http\Models;

use Illuminate\Database\Eloquent\Model;

class COMMON extends Model
{
    /**
     * 访问图片路径
     * @web 注册用户头像，商品颜色，购物车图标
     */
    protected static function web_img_path()
    {
        return env('APP_WEB_PATH');
    }

    /**
     * @erp 家具图片，优惠券图片
     */
    protected static function erp_img_path()
    {
        return env('STATIC_FILE_ERP_PATH');
    }

    /**
     * 颜色图片
     * 接口数据查询参考使用
     * @path 图片路径
     * @name 图片指代的颜色
     */
    protected static function color_path()
    {
        $path = self::web_img_path();
        $color_arr = [
            '1'=>array('path'=>$path.'/img/color/1.png','name'=>'黑'),
            '2'=>array('path'=>$path.'/img/color/2.png','name'=>'黄'),
            '3'=>array('path'=>$path.'/img/color/3.png','name'=>'橙红'),
            '4'=>array('path'=>$path.'/img/color/4.png','name'=>'白色'),
            '5'=>array('path'=>$path.'/img/color/5.png','name'=>'木色1'),
            '6'=>array('path'=>$path.'/img/color/6.png','name'=>'木色2'),
            '7'=>array('path'=>$path.'/img/color/7.png','name'=>'蓝色'),
            '8'=>array('path'=>$path.'/img/color/8.png','name'=>'紫色'),
            '9'=>array('path'=>$path.'/img/color/9.png','name'=>'黄绿')
        ];
        return $color_arr;
    }

    /**
     * 热门家具
     * @face 是否是封面图片[1是封面，0不是封面]
     */
    protected static function hotfitment()
    {
        $path = self::web_img_path();
        $fitment_array = [
            array('img'=>$path.'/img/hotfit.jpg','face'=>1),
            array('img'=>$path.'/img/banner/hot1.png','face'=>0),
            array('img'=>$path.'/img/banner/hot2.png','face'=>0)
        ];
        return $fitment_array;
    }
}
